package cheeese.and.crackers;

import java.io.Serializable;

/**
 * Class representing a user and the information it holds.
 * @author Cheese and Crackers
 *
 */
public class User implements Serializable{
	private static final long serialVersionUID = 3022582400209769994L;
	private String name;
	private String email;
	private String loginId;
	private String password;
	private TaskList tasks;
	
	static String ACTIVE_USER_FILE_NAME = "active_user_storage";
	
	/**
	 * Constructor that initializes user with given information
	 * @param name User's name
	 * @param email User's email
	 * @param loginId User's login ID
	 * @param password User's super secret password stored in plain text
	 */
	public User(String name, String email, String loginId, String password) {
		this.name = name;
		this.email = email;
		this.loginId = loginId;
		this.password = password;
		tasks = new TaskList();
	}
	
	/**
	 * @return Tasklist of user
	 */
	public TaskList getTasks(){
		return tasks;
	}
	
	/**
	 * @return Name of User
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets user's name
	 * @param name User's name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return Email of user
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * Sets user's email
	 * @param email User's email
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return Password of User
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * Sets user's password
	 * @param password User's password
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return Login ID of User
	 */
	public String getLoginId() {
		return loginId;
	}
	
	/**
	 * Sets user's Login ID
	 * @param loginId User's Login ID
	 */
	public void setLoginId(String loginId) {
		this.loginId = loginId;
	}

	/**
	 * Checks the password for the current user
	 * 
	 * @param password The password to compare
	 */
	public boolean checkPassword(String password) {
		return this.password.equals(password);
	}
}
